<?php 
Yii::app()->clientScript->registerScript('type',
        "var type='$type';",  CClientScript::POS_HEAD);
switch($type){
    case DOCTYPE_CUST:
        Yii::app()->clientScript->registerScript('data',"
                var custno='$customer->custno';
                var locno=null;
                var dispatch=null;",CClientScript::POS_HEAD);
        break;
    case DOCTYPE_LOC:
        Yii::app()->clientScript->registerScript('data',"
                var custno='$location->custno';
                var locno='$location->locno';
                var dispatch=null",CClientScript::POS_HEAD);
        break;
    case DOCTYPE_DISPATCH:
        Yii::app()->clientScript->registerScript('data',"
                var custno=null;
                var locno=null;
                var dispatch='$dispatch->dispatch';
                ",CClientScript::POS_HEAD);
        break;
        
}
?>

<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl.'/js/app/documents.js',CClientScript::POS_BEGIN);?>

<div id="left-col">
    <?php 
    switch($type){
        case DOCTYPE_CUST:
            $this->renderPartial('_side',array(
                'customer'=>$customer,
                'type'=>$type,
            ));
            break;
        case DOCTYPE_LOC:
            $this->renderPartial('_side',array(
                'location'=>$location,
                'customer'=>$customer,
                'type'=>$type,
            ));
            break;
        case DOCTYPE_DISPATCH:
            $this->renderPartial('_side',array(
                'dispatch'=>$dispatch,
                'type'=>$type,
            ));
            break;

    }
    ?>
    
    

</div>

<div id="right-col">

    <div class="wrap">
        <div class="container">

            
            <div id="breadcrumb" style="display:none;"><span style="padding-left:10px;font-size:10px;color:#777777;" id="alsoviewing"></span></div>
            <div class="inside">

                <?php switch($type){
                    case DOCTYPE_CUST:
                        $this->renderPartial('/customers/_view',array(
                            'customer'=>$customer,
                        ));
                        $this->renderPartial('/customers/_tab',array(
                            'model'=>$customer,
                        ));
                        break;
                    case DOCTYPE_LOC:
                        $this->renderPartial('/locations/_view',array(
                            'location'=>$location,
                        ));
                        $this->renderPartial('/locations/_tab',array(
                            'model'=>$location,
                        ));
                        break;
                    case DOCTYPE_DISPATCH:
                        $this->renderPartial('/dispatchdetails/_view',array(
                            'dispatch'=>$dispatch,
                            'location'=>$dispatch->location
                        ));
                        $this->renderPartial('/dispatchdetails/_tab',array(
                            'model'=>$dispatch
                        ));
                        break;

                }?>


                
                
                <br/>

                    <iframe id="downloadFrame" style="display:none"></iframe>
                    <div id="document-list">
                        
                    </div>
              
            </div><!-- inside -->
        </div><!-- container -->
    </div><!-- wrap -->
    <?php $this->renderPartial('/copyright'); ?>
</div> <!-- left-col -->